package com.ccsoft.nio;

import java.nio.ByteBuffer;

// 演示 buffer 按照类型 put get
public class Ch06BufferType {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
        byteBuffer.putInt(10);
        byteBuffer.putChar('上');
        byteBuffer.putLong(12L);

        byteBuffer.flip();

        System.out.println(byteBuffer.getInt());
        System.out.println(byteBuffer.getChar());
        System.out.println(byteBuffer.getLong());
    }
}
